Now I'm going to add scripts to my mind and I'm going to start with the LED.
I'm going to make the blank script.
So let's go to our landmine led.
Hit the plus, add a script, and we'll just change that to blank.
I'll get rid of that print statement.
I'm not going to need it, but I do need a variable local led script dot parent.
So this is going to get me a variable to my led to the part that the script is attached to.
I'll say local.
I need a random number generator so that all the blinks aren't exactly the same because that would look
weird.
I'm going to call that R&D and then we'll use this random class random dot new to get an instance of
random number generator not using a seed value.
If you guys know what that means, you're more than welcome to use it.
Overkill for a blank script.
All right, now I need two variables.
One, for how long?
The light's going to be on.
One for how long?
The light's going to be off.
I'll say.
Local on pause.
It's paused on how long it's going to be on.
We'll do R&D from our random number generator colon.
I'm going to hit next number, not next integer, because I want a decimal number somewhere between
a half a second and a second.
So next number, point 5 to 1 second.
Right?
And then the off pause is going to be how long the light is off.
So I'll use a random number generator.
Next number, I'll go from one second to 1.5 seconds.
So it's going to be off a little longer than on that.
I'll do a while.
True.
Do loop.
So this will loop as long as the mine is in the game.
But when it gets blown up, it's going to be it's going to be cleaned up.
So this will stop.
We're going to start out with the LED material as the default material.
Every time we start a new iteration of the loop, we'll use our enum material Neon.
That's what we started with.
The LED brick color will be brick color, new, really red.
All right.
So I had to use the new operator to get that really red because the default colors just aren't that
specific.
And then I'll wait and we'll go on pause.
That's how long it's going to stay on.
And now we're going to go, oh, we're going to turn it off.
So led material, let's make it something bland like plastic E material, dot plastic, and we'll change
the color.
Let's go LED brick color.
And I can use the default brick color dot black.
Right?
I don't have to get fancy with that one.
And then we'll do wait off.
Pause.
All right, let's see what we got.
Let's play our game, see if we've got some blinking going on.
There we go.
I like it.
Probably not what you would do in a real military situation, but it's it's kind of cool for the game.
So let's go ahead and in the next video, we will make it blow up.